package socket.auction.server;
import java.io.*;
import java.net.*;


//Sendet Notification an Client Uber UDP
public class Notification {
	private int port=0;
	private String message;
	private InetAddress client;
	
	public Notification(int port, String message, InetAddress client){
		this.port= port;
		this.message=message;
		this.client = client;
		//sendMessage(); ---Deactivation of UDP Notification
		
	}
	//Senden
	private void sendMessage(){
		DatagramSocket serverSocket=null;
		try {
			serverSocket = new DatagramSocket();
		} catch (SocketException e) {
			System.out.println("Error: Creating DatagramSocket");
		}
		
		//Zu sendendes Packet
		byte[]sendData = new byte[1024];
		sendData = message.getBytes();
		DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length,client,port);
		
		try {
			//Packet wird an Client gesendet
			serverSocket.send(sendPacket);
		} catch (IOException e) {
			System.out.println("Error: Client is not available to receive Notification");
		}
		
	}
	

}
